extends "../xili-3/xili-3.gd"


var baseId = ""
var upText1 = "每次触发血怒，恢复20%血量"
var upText2 = "血怒伤害提高40%"
func _extInit():
	._extInit()
	lv = 4             #等级的设置
	addSkill("<限定>受到致命伤害时，和敌方血量最高的单位互换血量", "绝地反击")
var cflag = true

func _onBattleStart():
	._onBattleStart()
	cflag = true

func onHurtDeath(atkInfo):
	.onHurtDeath(atkInfo)
	if team == 1 and atkInfo.hurtChaDead and cflag:
		atkInfo.hurtChaDead = false
		utils.createSkillTextEff("绝地反击", position)
		cflag = false
		var chas = getAllChas(1)
		chas.sort_custom(self,"sortByHpDesc")
		for i in chas:
			var hp = i.att.hp
			if team == 1:
				i.forceHurtSelf(att.hp)
			else:
				i.forceHurtSelf(att.hp)
			att.hp = hp
			break

func upgrade():
	.upgrade()
	if upgraded == 2:
		p2 = 1.4